package com.market.domain.strategy.model.entity;


import com.market.domain.strategy.model.valobj.RuleLogicCheckTypeVO;
import lombok.*;

//过滤完规则之后返回的动作实体
//过滤分为抽奖前（判断黑名单以及权重抽奖）和抽奖后（判断lock的奖品）
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RuleActionEntity <T extends RuleActionEntity.RaffleEntity>{

    private String code = RuleLogicCheckTypeVO.ALLOW.getCode();
    private String info = RuleLogicCheckTypeVO.ALLOW.getInfo();
    //判断的是哪个规则
    private String ruleModel;
    private T data;

    static public class RaffleEntity{

    }

    @Data
    @EqualsAndHashCode(callSuper = true)
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    //抽奖前
    static public class RaffleBeforeEntity extends RaffleEntity{

        //以下为需要返回的值
        /**
         * 策略ID
         */
        private Long strategyId;

        /**
         * 权重值Key；用于抽奖时可以选择权重抽奖。
         * 为传入IStrategyDispatch中的ruleWeightValueKey
         */
        private String ruleWeightValueKey;

        /**
         * 奖品ID；若黑名单，直接返回奖品
         */
        private Integer awardId;
    }

    //抽奖中
    static public class RaffleDuringEntity extends RaffleEntity{

    }

    //抽奖后
    static public class RaffleAfterEntity extends RaffleEntity{

    }
}
